package ${{info.basePackage}}.${{info.controlPackage}}.${{info.tablePackage}};

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import ${{info.basePackage}}.common.RequestUtil;
import ${{info.basePackage}}.web.common.BaseTableController;
import ${{info.basePackage}}.${{info.modelPackage}}.${{info.tablePackage}}.${{info.tableName}};
import ${{info.basePackage}}.${{info.servicePackage}}.${{info.tablePackage}}.${{info.tableName}}Service;

/**
 * ${{info.name}} - ${{info.table}}
 *
 * @author Virens
 * @since ${{info.date}}
 */
@Controller
@RequestMapping("/admin/${{info.path}}/${{info.key}}")
public class ${{info.tableName}}Contorller extends BaseTableController<${{info.tableName}}, ${{info.tableName}}Service> {

	public ${{info.tableName}}Contorller() {
		super("/admin/${{info.path}}/${{info.key}}", "${{info.identity}}:${{info.key}}");
	}
	
	@RequestMapping("view.jspx")
	public String viewJspx(HttpServletRequest request, HttpServletResponse response, Model model) {
		model.addAttribute("record", mBaseService.selectOne(RequestUtil.getValueInt(request, "id")));

		return returnUrl("view");
	}
	
	@RequestMapping("create.jspx")
	public String createJspx(HttpServletRequest request, HttpServletResponse response, Model model) {
		return returnUrl("create");
	}

	@RequestMapping("update.jspx")
	public String updateJspx(HttpServletRequest request, HttpServletResponse response, Model model) {
		model.addAttribute("record", mBaseService.selectOne(RequestUtil.getValueInt(request, "id")));

		return returnUrl("update");
	}
	
}
